<template>
  <div class='exam-dialog'>
    <el-dialog title="考试信息" top="10px" class="large_dialog" :visible.sync="dialogVisible" :close-on-click-modal="false">
      <custom-title title="考试信息"></custom-title>
      <BaseDescriptions :descConfig="descConfig" :descModel="descModel" :descConfigItem="descConfigItem"></BaseDescriptions>
      <custom-title title="考试结果"></custom-title>
      <BaseTable :tableModel="resultList" :tableItemConfig="tableConfig" hasIndex></BaseTable>
      <pagination v-if="total>0" :total="total" :page.sync="serachMap.pageNum" :limit.sync="serachMap.pageSize" />
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false" class="btn_cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { addExam, updateExam } from '@/api/examination'
import SelectPaperDialog from './SelectPaperDialog'
export default {
  data () {
    return {
      dialogVisible: false,
      // 描述配置
      descConfig: {
        size: 'medium',
        column: '3',
      },
      // 详情页数据
      descModel: {},
      // 详情页配置项
      descConfigItem: [
        {
          fieIdName: 'examName',
          label: '考试名称',
          span: '3'
        },
        {
          fieIdName: 'examPaperName',
          label: '试卷名称',
          span: '1'
        },
        {
          fieIdName: 'examDuration',
          label: '考试限时',
          span: '1'
        },
        {
          fieIdName: 'examPassScore',
          label: '通过分数',
          span: '1'
        },
        {
          fieIdName: 'examTarget',
          label: '考试对象',
          span: '3'
        },
        {
          fieIdName: 'examRange',
          label: '考试范围',
          span: '3'
        },
        {
          fieIdName: 'examStartTime',
          label: '考试开始时间',
          span: '3'
        },
      ],
      // 考试结果列表
      resultList: [],
      // 考试结果表格配置项
      tableConfig: [
        {
          label: '姓名',
          prop: 'examPaperName',
        },
        {
          label: '手机号',
          prop: 'remark',
        },
        {
          label: '考试时长',
          prop: 'examDuration',
        },
        {
          label: '考试分数',
          prop: 'examPassScore',
        },
        {
          label: '空白题',
          prop: 'examPassScore',
        },
      ],
      // 表格分页
      serachMap: {
        pageNum: 1,
        pageSize: 5,
      },
      total: 0
    };
  },
  computed: {},
  watch: {},
  methods: {
    // show 方法
    show (data) {
      this.dialogVisible = true
      if (data !== undefined) {
        this.$nextTick(() => {
          console.log(data)
          this.descModel = JSON.parse(JSON.stringify(data))
        })
      }
    }
  },
  created () {

  },
  mounted () {

  },
  components: {
    SelectPaperDialog
  },
}
</script>

<style lang='less' scoped>
</style>